﻿#include<iostream>

#include<string>

using namespace std;



class Student

{

public:

    //利用构造函数实例化信息

Student(string id, string name, string classroom, int num, string address):
    ​m_Id(id),

        m_Name(name),

        m_Classroom(classroom),

        m_Num(num),

        m_Address(address)

    { }

        Student(const Student& other)

    {

        m_Id = other.m_Id;

        m_Name = other.m_Name;

        m_Classroom = other.m_Classroom;

        m_Num = other.m_Num;

        m_Address = other.m_Address;

    }

    //下面是修改学生信息的成员函数

    void setId(string id)

    {

        m_Id = id;

    }

    void setName(string name)

    {

        m_Name = name;

    }

    void setClassroom(string classroom)

    {

        m_Classroom = classroom;

    }



    void setNum(int num)

    {

        m_Num = num;

    }

    void setAddress(string address)

    {

        m_Address = address;

    }



    void func()

    {

        cout << "学号为：" << this->m_Id << endl;

        cout << "姓名为：" << m_Name << endl;

        cout << "班级为：" << m_Classroom << endl;

        cout << "CPP分数为：" << m_Num << endl;

        cout << "家庭地址为：" << m_Address << endl;

    }

private:
    string m_Id ;
    string m_Name;
    string m_Classroom;
    int m_Num;
    string m_Address;

};



int main()

{


    Student s1("23012739", "杨旭杰", "四班", 100, "河北");

    s1.func();

    //利用复制构造函数

    Student s2(s1);

    s2.setId("12345678");

    s2.setName("李四");

    s2.setClassroom("六班");

    s2.setNum(99);

    s2.setAddress("北京");

    s2.func();

    return 0;

}